#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <math.h>
#include <string.h>

char symbols[] = "~!@#$%^&*()[]}{|\\<>?/.,:\"\'“”‘’";

int vaildate(char* pwd) {
	if (strlen(pwd) < 6) {
		return 0;
	}
	
	int has_num = 0;
	int has_upper_letter = 0;
	int has_lower_letter = 0;
	int has_symbol = 0;
	
	for (int i = 0; i < strlen(pwd); i++) {
		char ch = pwd[i];
		if ('0' <= ch && ch <= '9') {
			has_num = 1;
		} else if ('a' <= ch && ch <= 'z') {
			has_lower_letter = 1;
		} else if ('A' <= ch && ch <= 'Z') {
			has_upper_letter = 1;
		} else if (strchr(symbols, ch) != 0) {
			has_symbol = 1;
		}
	}

	return (has_num + has_upper_letter + has_lower_letter + has_symbol) >=3;

}

int main() {
	int n;
	scanf("%d", &n);
	char buf[1024] = { 0 };

	//When n approaches 0 do {
	while (n-- > 0) {
		scanf("%1020s", buf);
		puts(vaildate(buf) ? "yes" : "no");
	}
}
